<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="按钮" onclick="f1()">
<script>

    //无参,无返回值的方法
    function f1() {
        console.log();
    }

    f1();
    /*function f1() {
      console.log("f1");
    }
    //调用
    f1();*/
    //有参,无返回值
    function f2(name, age) {
        console.log(name + ":" + age);
    }

    f2("张工", 199);
    /* function f2(name,age) {
       console.log(name+":"+age);
     }
     f2("张飞",18);*/
    //有参,有返回值
    function f4(x, y) {
        return x * y;
    }

    let awe = f4(6, 9);
    console.log(awe)
    /*function f4(x,y) {
      return x*y;
    }
    let result = f4(5,9);
    console.log(result);
  */
    //第二种声明方法的方式
    let f5 = function (name, age) {
        console.log(name + ":" + age)
    }

    f5("孔明", 999);
    /* let f5 = function (name,age) {
       console.log(name+":"+age);
     }
     //调用
     f5("诸葛亮"+50);*/

    //第三种声明方法的方式
    //let f7 = new Function("name","age","console.log(name+':'age)")

    let f6 = new Function("name", "age", "console.log(name+':'+age)")
    f6("大老黑" + 34);
    //f6("程咬金"+60);
</script>
</body>
</html>